-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the ability to yield
a message.
#6306
Conversation
Standard loggers in Ruby mostly `yield` their messages (this is the default behavior of Ruby's own logger.) Or if there is a block then the message is the topic, a colon is automatically added, and the message is shipped with the topic. Jekyll should conform to this behavior so that it's logger can be passed to libraries that expect this standard behavior. ```ruby [1] pry(main)> Jekyll.logger.info("Just so you know") # => Just so you know [2] pry(main)> Jekyll.logger.info("Just so you know", "this is a message") # => Just so you know this is a message [3] pry(main)> Jekyll.logger.info("Just so you know") { "this is a message" } # => Just so you know: this is a message ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! Just 2 small changes that should fix the CI errors.
@@ -79,7 +79,7 @@ def warn(topic, message = nil) | |||
# | |||
# Returns nothing | |||
def error(topic, message = nil) | |||
writer.error(message(topic, message)) | |||
writer.error(message(topic, message, &block)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add this to the method signature on line 81
@@ -69,7 +69,7 @@ def info(topic, message = nil) | |||
# | |||
# Returns nothing | |||
def warn(topic, message = nil) | |||
writer.warn(message(topic, message)) | |||
writer.warn(message(topic, message, &block)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add this to the method signature on line 71 (&block)
The original repository is gone so no edits can be made. Rolled this change into #6315. |
Standard loggers in Ruby mostly
yield
their messages (this is the default behavior of Ruby's own logger.) Or if there is a block then the message is the topic, a colon is automatically added, and the message is shipped with the topic. Jekyll should conform to this behavior so that it's logger can be passed to libraries that expect this standard behavior.